package com.jams.goodox.activity.home;

import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;

import com.jams.goodox.BaseActivity;
import com.jams.goodox.R;
import com.jams.goodox.utils.StyleUtil;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/10/8.
 */

public class ChoosePayWayActivity extends BaseActivity {
    @Bind(R.id.tx_zfl)
    TextView txZfl;
    @Bind(R.id.tx_wx)
    TextView txWx;
    @Bind(R.id.tx_yj)
    TextView txYj;
    @Bind(R.id.tx_sure_pay)
    TextView txSurePay;

    @Override
    protected int getLayoutId() {
        return R.layout.choose_pay_way_activity;
    }

    @Override
    protected void init() {
        StyleUtil.titleBackKey(this, "选择支付方式");
    }

    @OnClick({R.id.tx_zfl, R.id.tx_wx, R.id.tx_yj, R.id.tx_sure_pay})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tx_zfl:
                onChoosePay(0);
                break;
            case R.id.tx_wx:
                onChoosePay(1);
                break;
            case R.id.tx_yj:
                onChoosePay(2);
                break;
            case R.id.tx_sure_pay:
                break;
        }
    }

    private void onChoosePay(int position){
        txZfl.setTextColor(ContextCompat.getColor(this,position==0?R.color.font_color_red:R.color.font_color_black));
        txWx.setTextColor(ContextCompat.getColor(this,position==1?R.color.font_color_red:R.color.font_color_black));
        txYj.setTextColor(ContextCompat.getColor(this,position==2?R.color.font_color_red:R.color.font_color_black));
        txZfl.setBackground(ContextCompat.getDrawable(this,position==0?R.drawable.bg_cancel_white_red:R.drawable.bg_cancel_white_black));
        txWx.setBackground(ContextCompat.getDrawable(this,position==1?R.drawable.bg_cancel_white_red:R.drawable.bg_cancel_white_black));
        txYj.setBackground(ContextCompat.getDrawable(this,position==2?R.drawable.bg_cancel_white_red:R.drawable.bg_cancel_white_black));
    }
}
